package cn.doitedu.datayi.etl

import org.apache.spark.sql.SparkSession

object He {
  def main(args: Array[String]): Unit = {

    val spark = SparkSession.builder()
      .appName("")
      .enableHiveSupport()
      .master("local")
      .getOrCreate()


    spark.sql(
      """
        |
        |SELECT
        | guid,
        | sum(x)
        |from (
        |select
        |  guid,
        |  cast ( pow(2,datediff(dt,date_sub('2021-08-31',30))) as int ) as x
        |from dws23.app_user_dau_bm
        |where dt  between  date_sub('2021-08-31',30)   and '2021-08-31'
        |) o
        |group by guid
        |
        |
        |""".stripMargin).show(100,false)



    spark.close()

  }

}
